﻿using System;

namespace SCSInternetBanking.LibertyReserve
{
    public static class TransferSample
    {
        private static readonly ApiCredentials g_credentials = new ApiCredentials()
        {
            AccountNumber = "U1234567",
            ApiName = "ApiName",
            SecurityWord = "SecurityWord",
        };

        static void Main(string[] args)
        {
            IApiAgent agent = ApiAgentFactory.Create(ApiProtocol.Xml, g_credentials);
            agent.RequireValidSslCertificate = true;

            try
            {
                HistoryItem history = agent.Transfer(new Transfer()
                {
                    Payee = "U7654321",
                    Amount = 1.00M,
                    Currency = Currency.Usd,
                    Purpose = PaymentPurpose.Service
                });

                Console.WriteLine("Transfer batch number: {0}", history.Batch);
            }
            catch (ApiException ex)
            {
                Console.Error.WriteLine(ex);
            }
        }
    }
}
